﻿using Base.Helper;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Model
{

    [Serializable]
    public class cms_article_fields_value
    {

        private readonly EFContext _context;
        public cms_article_fields_value(EFContext context)
        {
            _context = context;
        }

        #region 
        /// <summary>
        /// id
        /// </summary>		
        public int id { get; set; }
        /// <summary>
        /// fields_id
        /// </summary>		
        public int fields_id { get; set; }
        /// <summary>
        /// fields_name
        /// </summary>		
        public string fields_name { get; set; }
        /// <summary>
        /// article_id
        /// </summary>		
        public int article_id { get; set; }
        /// <summary>
        /// fields_value
        /// </summary>		
        public string fields_value { get; set; }
        #endregion

        #region  帮助方法
        public string getArticleFieldsValue(int articleId, int FieldsId)
        {
            string v = "";
            if (articleId <= 0 || FieldsId <= 0) return v;
            cms_article_fields_value model = _context.cms_article_fields_value.AsNoTracking().FirstOrDefault(item => (item.fields_id == FieldsId && item.article_id == articleId));
            if (model != null) v = GetHelper.GetStr(model.fields_value);
            return v;
        }

        #endregion


    }
}
